# -*- coding: utf-8 -*-
# @Time    : 2024/3/10 15:25
# @Author  : xh
# @FileName: tools.py
# @Software: PyCharm
import re

def replace_data(data,cls):

    while re.search('#(.+?)#', data):
        # 搜索第一个符合特定模式的子串
        res = re.search('#(.+?)#', data)
        item = res.group()
        attr = res.group(1)
        value = getattr(cls, attr)
        data = data.replace(item, str(value))

    return data